#pragma once
#include <import\ix_Artimport.h>
#include <vector>
#include <string>

class Cx_ArtImport :
	public Ix_ArtImport
{
	X3BEGIN_CLASS_DECLARE(Cx_ArtImport)
		X3DEFINE_INTERFACE_ENTRY(Ix_ArtImport)
		X3END_CLASS_DECLARE()
protected:
	Cx_ArtImport(void);
	virtual ~Cx_ArtImport(void);
public:
	virtual BOOL Open() ;
	virtual LPWSTR GetPath();
	virtual BOOL ImportContent(const wchar_t* path,int nClass,AddCategory addCate,AddArticle addArt) ;
protected:
	TCHAR						m_szPath[MAX_PATH];

	LPWSTR Ansi2Unicode(LPCSTR lpStr,  DWORD nMaxLen)
	{
		LPWSTR lpResult = NULL;

		size_t nLen = strlen(lpStr);
		DWORD dwNum = MultiByteToWideChar(CP_ACP, 0, lpStr, (DWORD)nLen, NULL, 0);
		
		lpResult = new WCHAR[max(dwNum, nMaxLen) + 1];
		if ( lpResult != NULL )
		{
			lpResult[0] = 0;
			MultiByteToWideChar(CP_ACP, 0, lpStr, (DWORD)nLen, lpResult, dwNum);
			lpResult[dwNum] = 0;
		}

		return lpResult;
	}
	
};
BOOL CompFileName(std::wstring file1,std::wstring file2);
void trim(std::wstring& str);